package com.coocaa.ops.admin.async;


import com.coocaa.ops.admin.v1.hvi.service.IHistoryVersionInfoService;
import com.coocaa.ops.common.core.base.model.ResourceBaseModel;
import com.coocaa.ops.common.core.biz.cache.service.MultiCenterCacheUpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author bijiahao
 * @date : 2019/7/19.
 * @description 审核操作，上架操作，定时等 执行完后，需要执行的异步操作 统一处理
 */
@Service
public class MyAsyncOpsMgrServiceImpl {
    @Autowired
    private MultiCenterCacheUpdateService multiCenterCacheUpdateService;
    @Autowired
    private IHistoryVersionInfoService historyVersionInfoService;


    /**
     * 需要执行的异步操作 统一处理
     *
     * @param resourceBaseModel
     */
    public void handleCommonAsyncOps(ResourceBaseModel resourceBaseModel, Integer userId) {
        //插入版本历史表
        historyVersionInfoService.addHistoryVersionInfo(resourceBaseModel, userId);
        //更新缓存-包含多中心的
        multiCenterCacheUpdateService.updateMultiCenterCache(resourceBaseModel.getId(), resourceBaseModel.getType());
    }

    /*************** ===私有方法=== ********************* ===start=== ***************************************/

}
